package liu.first;


import org.junit.Test;

/**
 * 2、编写一个函数将一个十六进制数的字符串参数转换成整数返回
 * @author My
 *
 */
public class change10from16 {
	
	@Test
	public void testName() throws Exception {
		String str="13afe";
		int sun=0;
		int len=str.length();
		for(int i=0;i<len;i++){
			char charAt = str.charAt(len-i-1);
			
			int n = Character.digit(charAt,16);
			sun+=n * (1<<(4*i));
		}
		System.out.println(sun);
		
	}

}
